package javaParser;
/*
 * RdfClass.java
 *
 * Created on February 26, 2008, 12:34 PM
 *
 */

/**
 *
 * @author Tian, Juan
 */
import java.util.LinkedList;
public class RdfClass extends RdfTreeNode{
    
    private LinkedList<RdfMethod> methods;
    private LinkedList<RdfField> fields;
    private LinkedList<RdfConstructor> contructors;
    private RdfClass superclass;
    private LinkedList <RdfInterface> superInterfaces;
    private LinkedList <String> imports;
    private RdfMethod currentMethod = null;
    
    
    /** Creates a new instance of RdfClass */
    public RdfClass() {
        this("default");
    }
    public RdfClass(String name){
        this("default", name, null);
    }
    public RdfClass(String name, String type){
        this("default", name, type);
    }
    public RdfClass(String perfix, String name, String type) {
        this(perfix, name, type, null);
    }
    public RdfClass(String perfix, String name, String type, RdfClass superclass) {
        super(perfix, name, type);
        methods = new LinkedList <RdfMethod>();
        fields = new LinkedList <RdfField>();
        contructors = new LinkedList <RdfConstructor>();
        superInterfaces = new LinkedList <RdfInterface>();
        imports = new LinkedList <String>();
        this.superclass = superclass;
    }
    
    public LinkedList<RdfMethod> getMethods() {
        return methods;
    }
    public LinkedList<RdfField> getFields() {
        return fields;
    }
    public LinkedList<RdfConstructor> getContructors() {
        return contructors;
    }
    public LinkedList <RdfInterface> getSuperInterfaces() {
        return superInterfaces;
    }
    public LinkedList <String> getImports() {
        return imports;
    }
    public void setSuperclass(RdfClass s) {
        superclass = s;
    }
    public RdfClass getSuperclass() {
        return superclass;
    }
    public boolean addSuperInterface(RdfInterface s) {
        return superInterfaces.add(s);
    }
    public boolean addImport(String s) {
        return imports.add(s);
    }
    public boolean addMethod(RdfMethod a) {
        currentMethod = a;
        return methods.add(a);
    }
    public boolean addField(RdfField a) {
        return fields.add(a);
    }
    public boolean addContructor(RdfConstructor a) {
        return contructors.add(a);
    }
    public void addMethod(int i, RdfMethod a){
        currentMethod = a;
        methods.add(i, a);
    }
    public void addParam(RdfParam p){
        currentMethod.addParam(p);
    }
    public void addCalls(RdfMethod m){
        currentMethod.addCalls(m);
    }
    public RdfMethod getMethod(int i){
        return getMethods().get(i);
    }
    public RdfField getField(int i){
    	return getFields().get(i);
    }
    public int sizeOfMethods() {
        return getMethods().size();
    }
    public int sizeOfFields() {
        return getFields().size();
    }
}